package thinkingJava.chapter16;

import java.util.Random;

import thinkingJava.chapter15.Generator;

public class RandomGenerator {
	private static Random r = new Random(47);
	public static class Boolean implements Generator<java.lang.Boolean> {
		public java.lang.Boolean next() {
			return r.nextBoolean();
		}
	}
	public static class Byte implements Generator<java.lang.Byte> {
		public java.lang.Byte next() {
			return (byte)r.nextInt();
		}
	}
	public static class Character implements Generator<java.lang.Character> {
		public java.lang.Character next() {
			return CountingGenerator.chars[r.nextInt(CountingGenerator.chars.length)];
		}
	}
	public static class String extends CountingGenerator.String {
		{
			cg = new Character();
		}
		public String() {

		}
		public String(int length) {
			super(length);
		}
	}
	public static class Short implements Generator<java.lang.Short> {
		public java.lang.Short next() {
			return (short)r.nextInt();
		}
	}
	public static class Integer implements Generator<java.lang.Integer> {
		private int mod = 10000;
		public Integer() {}
		public Integer(int modulo) {
			mod = modulo;
		}
		public java.lang.Integer next() {
			return r.nextInt(mod);
		}
	}
	public static class Long implements Generator<java.lang.Long> {
		private int mod = 10000;
		public Long() {}
		public Long(int modulo) {
			mod = modulo;
		}
		public java.lang.Long next() {
			return new java.lang.Long(r.nextInt(mod));
		}
	}
	public static class Float implements Generator<java.lang.Float> {
		public java.lang.Float next() {
			int trimmer = Math.round(r.nextFloat() * 100);
			return ((float)trimmer) / 100;
		}
	}
	public static class Double implements Generator<java.lang.Double> {
		public java.lang.Double next() {
			long trimmed = Math.round(r.nextDouble() * 100);
			return ((double)trimmed) / 100;
		}
	}
//	public static class StringGen implements Generator<String> {
//		public StringGen(int sz) {
//
//		}
//		public String next() {
//			return null;
//		}
//	}
//	public static Generator<String> String(int size) {
//		return new StringGen(size);
//	}
//	public static class IntegerGen implements Generator<Integer> {
//
//		public Integer next() {
//			return null;
//		}
//
//	}
//	public static Generator<Integer> Integer() {
//		return new IntegerGen();
//	}

}
